<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="css/eui.css">
    <style>
        body{
            font: 18px "Microsoft YaHei UI";
            margin: 0;
            background-color: #f1f1f1;
        }
        header a{
            text-decoration: none;
            color: #FFFFFF;
        }
        header a:hover{
            color: #0aa1ed;
        }
        /*去掉自带的内边距*/
        .el-table .el-table__cell{
            padding: 0;
            color: #FF6537;
            font: 20px "Microsoft YaHei UI";
        }
        .p_img:hover{
            position: relative;
            bottom: 5px;
            /*元素的阴影:x偏移值 y偏移值 浓度 范围 颜色*/
            box-shadow: 0 0 10px 5px #333;
        }
        div li a{
            color: #FFFFFF;
            font: 16px "Microsoft YaHei UI";
        }
        div li a:hover{
            color: #0aa1ed;
        }
    </style>
</head>
<body>
<div id="app">
    <el-header style="padding: 0;height: 40px;background-color:#FF6537">
        <div style="width: 1200px;margin: 0 auto">
            <el-row>
                <el-col :span="18" style="padding-top: 10px">
                    <i class="el-icon-s-home" style="color: #FFFFFF"></i>
                    <a href="">商城首页</a>
                    <a href="">宠物攻略</a>
                    <a href="">宠物交流中心</a>
                </el-col>
                <el-col :span="6" style="padding-top: 10px">
                    <a href="">登录</a>
                    <a href="">注册</a>
                    <i class="el-icon-shopping-cart-1" style="color: #FFFFFF"></i>
                    <a href="">购物车</a>
                    <i class="el-icon-user" style="color: #FFFFFF"></i>
                    <a href="">个人中心</a>
                </el-col>
            </el-row>
        </div>
    </el-header>
    <div style="display: flex;justify-content: center; background-color: #FFFFFF;">
        <div style="float: left">
            <img src="imgs/logo1.jpg"
                 style="width: 150px;vertical-align: middle" alt="">
            <!--搜索框开始-->
            <el-input style="width: 580px;border: 1px solid #FF6537;" v-model="input" placeholder="请输入内容"></el-input>
            <el-button type="搜索" round style="background-color: #FF6537;color: #FFFFFF">搜索</el-button>
            <!--搜索框结束-->
        </div>
    </div>
    <!--蓝色导航条开始-->
    <div style="width:1600px;height:60px;background-color: #FF6537;margin: 0 auto">
        <el-menu style="width: 1600px;margin: 0 auto"
                 default-active="1"
                 class="el-menu-demo"
                 mode="horizontal"
                 @select="handleSelect"
                 background-color="#FF6537"
                 text-color="#000000"
                 active-text-color="#fff">
            <el-menu-item index="1">生活服务</el-menu-item>
            <el-menu-item index="2">狗狗</el-menu-item>
            <el-menu-item index="3">猫猫</el-menu-item>
            <el-menu-item index="4">宠物器材</el-menu-item>
            <el-menu-item index="5">商品特价</el-menu-item>
        </el-menu>
    </div>
    <!--蓝色导航条结束-->
        </el-header>
        <el-main style="width: 1200px;margin: 0 auto">
            <!--商品详情开始-->
            <el-row :gutter="20">
                <!--将一行划分为两等份 24/2=12-->
                <el-col :span="12">
                    <el-card>
                        <img :src="product.url" width="100%" alt="">
                    </el-card>
                </el-col>
                <el-col :span="12">
                    <p style="font-size: 25px">{{product.title}}</p>
                    <el-divider></el-divider>

                    <p style="font-size: 25px;font-weight: bold">
                        ￥{{product.price}}
                        <span style="font-size:15px;color: #999 ">价格:
                            <s>{{product.oldPrice}}</s></span>
                    </p>
                    <!--二维码开始-->
                    <el-row :gutter="20" style="text-align: center">
                        <el-col :span="12">
                            <el-card>
                              <div>
                                  <a href="nonPayment.html">直接购买</a>
                              </div>
                            </el-card>
                        </el-col>
                        <el-col :span="12">
                            <el-card>
                                <div>
                                    <a href="">加入购物车</a>
                                </div>
                            </el-card>
                        </el-col>
                    </el-row>
                    <!--二维码结束-->
                </el-col>
            </el-row>
            <!--商品详情结束-->
        </el-main>
        <el-footer style="padding: 0">
            <div style="background-image: url('imgs/wave.png');
                    height: 95px;margin-bottom: -30px"></div>
            <div style="background-color: #3f3f3f;height: 100px;
                    font-size: 14px;color: #b1b1b1;
                    text-align: center;padding: 30px">
                <p>Copyright © 北京达内金桥科技有限公司版权所有 京ICP备12003709号-3 京公网安备 11010802029572号</p>
                <p>涵盖20余门课程体系，致力于打造权威的IT职业教育学习平台</p>
                <p>达内在线WWW.TMOOC.CN 专注于IT职业技能培训</p>
            </div>
        </el-footer>
    </el-container>
</div>
</body>
<!-- import Vue before Element -->
<script src="js/vue.js"></script>
<!-- import JavaScript -->
<script src="js/eui.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function() {
            return {
                categoryArr:[],
                wd:"",
                product:{}
            }
        },
        created:function () {
            //发请求获取所有分类信息
            axios.get("/category/select").then(function (response) {
                v.categoryArr = response.data;
            })
            //得到地址栏中的商品id
            let id = location.search.split("=")[1];
            //通过id发请求获取商品数据
            axios.get("/product/selectById?id="+id).then(function (response) {
                v.product = response.data;
            })
        },
        methods:{
            handleSelect(index){
                console.log(index);
                //此时的index代表的是分类的id 跳转页面并且把点击的分类id传递
                location.href="/result.html?cid="+index;
            },
            search(){
                //跳转到结果页面并且把搜索的关键字传递过去
                location.href="/result.html?wd="+v.wd;
            }
        }
    })
</script>
</html>